package zeroj.web.validator.impl;

import zeroj.web.validator.IValidator;

/**
 * 
 * @author LYL(lyl at gmail dot com)
 *
 * @since 1.0
 *
 * 2008-9-30
 */
public class IntegerValidator implements IValidator {

	private int min;
	private int max;
	
	public IntegerValidator(int min, int max) {
	
		this.max = max;
		this.min = min;
	}
	public boolean isValid(String value) {
		
		try {
			int i = Integer.parseInt(value);
			return i <= max && i >= min;
		} catch(NumberFormatException e) {
			return false;
		}
	}

}
